package com.ijianji.module_play_video.utils

import com.fenghuajueli.lib_data.entity.db.VideoInfoEntity
import java.util.*
import kotlin.collections.HashMap

object RandomUtils {


    private val random = Random()
    private val randomMap: MutableMap<String, Int> = HashMap<String, Int>()

    fun createRandom(list: MutableList<VideoInfoEntity>) {
        list.forEach {
            if (!randomMap.containsKey(it.vid)) {
                randomMap[it.vid] = random.nextInt(3000) + 2560
            }
        }
    }


    fun getSeeCount(vid: String): Int? {
        return if (randomMap.containsKey(vid)) {
            randomMap[vid]
        } else {
            random.nextInt(3000) + 2560
        }
    }
}